package dao;

//import java.io.Serializable;
//import java.util.List;

import org.hibernate.HibernateException;
//import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;

public class HibernateDao {
    private static SessionFactory sessionFactory = null;

    static {

        Configuration cfg = new Configuration();
        sessionFactory =
                cfg.configure("hibernate.cfg.xml").buildSessionFactory();
    }

    public static Session getSession() throws HibernateException {
        Session session = sessionFactory.openSession();
        return session;
    }

    /*
    public static Query query(String q) {
        return getSession().createQuery(q);
    }
    
    public static Object get(Class<?> clz, Serializable pk) {  
        return getSession().get(clz, pk);  
    }  
    
    public static List<?> getAll(Class<?> clz) {  
        return getSession().createCriteria(clz).list();  
    }  
    
    public static Serializable save(Object entity) {
        return getSession().save(entity);  
    }  
    
    public static void update(Object entity) {  
        getSession().update(entity);  
    }  
    
    public static void saveOrUpdate(Object entity) {  
        getSession().saveOrUpdate(entity);  
    }  
    
    public static void delete(Object entity) {  
        getSession().delete(entity);  
    }  
    */
}
